package com.baizhi.controller;

import com.baizhi.entity.CmfzBanner;
import com.baizhi.service.CmfzBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2019/4/8 0008.
 */
@Controller
@RequestMapping("/banner")
public class CmfzBannerController {

    @Autowired
    private CmfzBannerService cmfzBannerService;

    @RequestMapping("/showAll")
    public @ResponseBody Map showAll(Integer page, Integer rows){
        Map map = cmfzBannerService.queryAll(page, rows);
        return  map;
    }

    @RequestMapping("/add")
    public @ResponseBody Map add(MultipartFile picture,CmfzBanner cmfzBanner,  HttpServletRequest request){
        Map add = cmfzBannerService.add(picture,cmfzBanner,request);
        return add;
    }

    @RequestMapping("/update")
    public @ResponseBody Map update(MultipartFile picture,CmfzBanner cmfzBanner,  HttpServletRequest request){
        Map update = cmfzBannerService.update(picture,cmfzBanner,request);
        return update;
    }

    @RequestMapping("/deleteMany")
    public @ResponseBody  Map deleteMany(int[] ids){
        Map map = cmfzBannerService.deleteMany(ids);
        return map;
    }
}
